package com.hymall.controller.admin;

import com.hymall.bean.MarketComment;
import com.hymall.bean.bo.AdminSearchBO;
import com.hymall.bean.common.BasePageInfo;
import com.hymall.bean.common.BaseRespVo;
import com.hymall.bean.common.CommonData;
import com.hymall.service.admin.GoodsService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: haiyuny
 * @Date: 2022/7/18 16:44
 * @Description:
 */
@RestController
@RequestMapping("admin/comment")
public class AdminCommentController {
    @Autowired
    GoodsService goodsService;

    /**
     * 商品评论  ->  评论list
     *
     * @param info
     * @return
     */
    @RequestMapping("list")
    public BaseRespVo list(BasePageInfo info, AdminSearchBO search) {
        CommonData data = goodsService.queryCommentList(info, search);
        return BaseRespVo.ok(data);
    }

    /**
     * 商品评论  ->  评论list
     *
     * @param comment
     * @return
     */

    @RequiresPermissions(value = {"admin:comment:delete"})
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody MarketComment comment) {
        goodsService.deleteComment(comment);
        return BaseRespVo.ok(null);
    }
}
